/*
 * util.h
 *
 *  Created on: Apr 21, 2014
 *      Author: mitchellalpert
 */

#ifndef _UTIL_H_
#define _UTIL_H_

#include <stdio.h>

typedef enum {
	ADD, ADDI, AND, ANDI, BEQ, BNE, J, JAL, JR, LUI, LW, OR, ORI,
	SLL, SLT, SLTI, SRA, SRL, SW, SYSCALL
} instruction_name;

typedef enum {
	RTYPE, ITYPE, JTYPE
} instruction_type;

typedef struct {
	instruction_name name;
	instruction_type type;
	int num_args;
	union {
		int opcode;
		int funct;
	};
} instruction_info;

int getNextToken(FILE* stream, char* buffer, int maxLength);
instruction_info getInstructionInfo(const char* str);

#endif
